package com.jmectf.net.console;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.util.HashMap;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;

/**
 * <code>ServerInfo</code> is a window that is created
 * when <code>new server</code> is run from <code>ServerConsole</code>.
 * This windows displays the number of the users, a list of the users and their IPs.
 * It also has a TextArea for displaying messages from the server.
 * The user should have JRE 1.6.0.10 or higher installed for optimal performance.
 * @author Lev Krayzman
 * @version June 17, 2009 2:14 P.M.
 *
 */

public class ServerInfo extends JFrame {

    private static final long serialVersionUID = 1L;
    private JTextArea statusArea;
    private JTextArea messageArea;
   
    private JScrollPane statusPane;
    private JScrollPane messagePane;
   
    HashMap<String, String> man;

    /**
     * Constructor creates a new <code>ServerInfo</code>.
     * Sets up the GUI for the console.
     */
    public ServerInfo() {
        super("jmectf - SERVERINFO");
        Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize=new Dimension((int)(screenSize.width / 2), (int)(screenSize.height / 2));
        int x = (int)(frameSize.width );
        int y = (int)(0);
        setBounds(x,y,frameSize.width, frameSize.height);
        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
        statusArea = new JTextArea();
        statusArea.setEditable(false);
        statusArea.setFont(new Font("Courier New", Font.PLAIN, 13));
        statusArea.setBackground(Color.black);
        statusArea.setForeground(Color.green);
        statusArea.setLineWrap(true);
        GridLayout gL = new GridLayout(2, 1, 0, 5);
        getContentPane().setLayout(gL);
        statusPane = new JScrollPane(statusArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        this.add(statusPane);
        messageArea = new JTextArea();
        messageArea.setEditable(false);
        messageArea.setFont(new Font("Courier New", Font.PLAIN, 13));
        messageArea.setBackground(Color.black);
        messageArea.setForeground(Color.green);
        messageArea.setLineWrap(true);
        messagePane = new JScrollPane(messageArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        this.add(messagePane);
        com.sun.awt.AWTUtilities.setWindowOpacity(this, 0.8f);
        setVisible(true);
        statusArea.append("IDs\t\tIPs");
    }

	/**
	 * @return the statusArea
	 */
	public JTextArea getStatusArea() {
		return statusArea;
	}

	/**
	 * @return the messageArea
	 */
	public JTextArea getMessageArea() {
		return messageArea;
	}

}